<?php
	namespace Home\Controller;
	//use Think\Controller;
	class SingleController extends BaseController {
		/**
		 * 详细文章页面展示
		 */
		public function single() {
			// 获取id
			$id = I('get.id');
			// 获取所有文章
			$article = D('Article');
			
			// 文章的点击数+1
			$article->updateHits($id);
			$articleData = $article->getArticleById($id);
			
			// 获取本文评价
			$appraise = D('Appraise');
			$appraiseData = $appraise->getAppraiseDataById($id);
			//var_dump($appraiseData);die;
			//var_dump($articleData);die;
			// 分配变量
			$this->assign('visitor', $this->visitor);
			$this->assign('cateNum', count($this->headerData));
			$this->assign('cateData', $this->headerData);
			$this->assign('mostHits', $this->mostHits);
			$this->assign('AllCate', $this->AllCate);
			
			$this->assign('articleData', $articleData);
			$this->assign('appraiseData', $appraiseData);
			// 展示模板
			$this->display();
		}
	}
